﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using VerySmartSoftware.Emulator;

namespace TestProject1
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void Initialise()
        {
            CPU6502 cpu = new CPU6502();
            Assert.AreEqual<byte>(cpu.Ram[0], 0x00);
        }

        [TestMethod]
        public void TestLDA()
        {
            CPU6502 cpu = new CPU6502();
            Assert.AreEqual<byte>(cpu.Reg_A, 0x00); // Accumulator should be 0x00 on initialisation

            // Build a ram_basic program to load the accumulator with 255
            cpu.Ram[0] = 0xA9; // LDA
            cpu.Ram[1] = 0xFF; // immediate mode 255

            // Run the program (The PC is initialised to 0x00)
            cpu.Run();

            // Check we have loaded the accumulator
            Assert.AreEqual<byte>(cpu.Reg_A, 0xFF);
        }
    }
}
